package com.dl7.playerdemo.adapter;

import com.dl7.playerdemo.ResourceTable;
import ohos.agp.components.Component;
import ohos.agp.components.ComponentContainer;
import ohos.agp.components.LayoutScatter;
import ohos.agp.components.Text;
import ohos.app.Context;
import java.util.List;

/**
 * Created by Rukey7 on 2016/11/27.
 */

public class ListAdapter extends BaseListAdapter<String> {

    public ListAdapter(Context context) {
        super(context);
    }

    public ListAdapter(Context context, List<String> datas) {
        super(context, datas);
    }

    @Override
    public Component getComponent(int i
            , Component component, ComponentContainer componentContainer) {
        if (component == null) {
            component = LayoutScatter.getInstance(mContext).parse(ResourceTable.Layout_adapter_list
                    , componentContainer, false);
        }
        Text tvContent = (Text) component.findComponentById(ResourceTable.Id_tv_content);
        tvContent.setText(mDatas.get(i));
        return component;
    }
}
